<template>
  <div>
      <h1>登录界面</h1>
      <p>用户名：<input type="text" v-model="username"></p>
      <p>密  码：<input type="text" v-model="password"></p>
      <button @click="sub">登录</button>
  </div>
</template>

<script>
import axios from 'axios';
export default {
     data(){
        return {
            username:'',
            password:'',
            base_url:'http://127.0.0.1:8000'
        }
    },
    methods:{
        sub(){
            console.log(this.username,this.password)
            let form_data = new FormData()
            form_data.append('username',this.username)
            form_data.append('password',this.password)
            axios({
                url: this.base_url + '/app01/login',
                method:'post',
                data:form_data
            }).then(res =>{
                console.log(res.data)
            })
        }
    }
}
</script>

<style>

</style>